import request from '@/utils/request'

export const getUserAddressById = (addressBook) => {
  console.log(1, addressBook)
  return request({
    url: '/ios/addressBook/list',
    method: 'get',
    params: addressBook
  })
}

export const addUserAddress = (data) => {
  return request({
    url: '/ios/addressBook',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export const editUserAddress = (data) => {
  return request({
    url: '/ios/addressBook/edit',
    method: 'put',
    data: data,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export const deleteUserAddress = (addressId) => {
  return request({
    url: '/ios/addressBook/' + addressId,
    method: 'delete',
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export const setDefaultAddress = (addressId) => {
  return request({
    url: '/ios/addressBook/isDefault/' + addressId,
    method: 'put',
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
